home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 8 code / Curves in Quickdraw / QD Curves / curves.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-09  |  1.3 KB  |  69 lines  |  [TEXT/KAHL]

  1. #ifndef curveIncludes
  2. #define curveIncludes
  3.  
  4. #define kCurveLimit        3
  5.  
  6. #define FR(x)            ((x) + 0x8000 >> 16)
  7. #define ff(x)            ((long)(x) << 16)
  8. #define fmoveto(x,y)    MoveTo( FR(x), FR(y) )
  9. #define flineto(x,y)        LineTo( FR(x), FR(y) )
  10. #define AVE(a,b)        (((a) + (b)) / 2)
  11. #define anyNumber        1
  12.  
  13. typedef long fixed;
  14.  
  15. typedef struct {
  16.     fixed x;
  17.     fixed y;
  18. } point;
  19.  
  20. typedef struct {
  21.     point start;
  22.     point control;
  23.     point end;
  24. } curve;
  25.  
  26. typedef struct {
  27.     long        vectors;
  28.     long        controlBits[anyNumber];
  29.     point        vector[anyNumber];
  30. } path;
  31.  
  32. typedef struct {
  33.     long        contours;
  34.     path        contour[anyNumber];
  35. } paths;
  36.  
  37. int OnCurve(long* bits, long index);
  38. void FrameCurve(curve* cur, int level);
  39. path* FramePath(path*, int closed);
  40. void FramePaths(paths*, int closed);
  41. void MarkPaths(paths*);
  42. paths* AppendPaths(paths*, paths*);
  43. void GetPathsBounds(paths*, Rect*);
  44. void DisposePaths(paths*);
  45.  
  46. void OffsetPaths(paths*, fixed dx, fixed dy);
  47. void ScalePaths(paths*, fixed sx, fixed sy);
  48. void MapPaths(paths*, Rect* src, Rect* dst);
  49.  
  50. long SizeOfPaths(paths* p);
  51. paths* CopyPaths(paths* p);
  52.  
  53. typedef struct {
  54.     int isLine;
  55.     curve c;
  56.  
  57.     /* private */
  58.     long index;
  59.     long ep;
  60.     long* bits;
  61.     point* p;
  62. } pathWalker;
  63.  
  64. path* NextPath(path* aPath);
  65. void InitPathWalker( pathWalker* w, path* aPath );
  66. int NextPathSegment( pathWalker* w);    /* returns false when the path if finished */
  67.  
  68.  
  69. #endif